<template>
    <div class="view_box_content" >
        <div class="header">
            {{ DataLabel }}
        </div>
        <div class="content">
            {{truncateString(DataText)}}
            <span v-if="DataText.length>55" @click="$emit('viewrDetails',DataLabel,DataText)">查看详情</span>
        </div>
    </div>
</template>

<script>
export default {
    name: "RightDetailsItemCom",
    props: {
        DataLabel:{
            type: [String,undefined,null],
            required:true,
            default: ''
        },
        DataText:{
            type: [String,undefined,null],
            required: true,
            default: ''
        }
    },
    setup(){
        let truncateString = (str) => {
            if (str && str.length > 55) {
                return str.slice(0, 55) + '...';
            } else {
                return str;
            }
        }
        return{
            truncateString
        }
    }
}
</script>

<style scoped lang="less">
.view_box_content{
  background-color: rgba(4, 25, 56, 0.5);
  border: 1px solid #2989FF;
  padding: 10px;
  font-size: 16px;
  margin-top: 10px;
  .header{
    background: rgba(18, 111, 217, 0.61);
    color: #FFFFFF;
    height: 30px;
    line-height: 30px;
    text-align: center;
  }
  .content{
    margin-top: 10px;
    color: #CAD6EB;
    position: relative;
    span{
      margin-right: 10px;
      color: #30c6c5;
      position: absolute;
      right: 0;
      bottom: 0;
      cursor:pointer;
    }
  }
}
</style>